package com.zdky.tpl.queue;

import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.concurrent.CountDownLatch;

/**
 * 处理发票相关消费者
 */
@Component
public class ConsumerForInvoice {

    protected Logger logger = LoggerFactory.getLogger(this.getClass());

    @Autowired
    private CountDownLatch countDownLatch;

    @Autowired
    private ConsumerProcessor consumerProcessor;


    /**
     * 处理发票
     */
    public void invoiceHandle(String msg){
        if(StringUtils.isNotEmpty(msg)){
            JSONObject jsonObject = JSONObject.parseObject(msg);
            JSONArray data = jsonObject.getJSONArray("data");
            consumerProcessor.getY2TInvoiceApplyEx(data);
        }
    }


}
